package com.rms.service.impl;

import java.util.List;

import com.rms.dao.IFoodDao;
import com.rms.entity.Food;
import com.rms.service.IFoodService;
import com.rms.utils.PageBean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class FoodService implements IFoodService{

	@Resource
	IFoodDao foodDao;
	
	@Override
	public void add(Food food) {
		foodDao.add(food);
	}

	@Override
	public void delete(int id) {
		foodDao.delete(id);
		
	}

	@Override
	public void updata(Food food) {
		foodDao.updata(food);
		
	}

	@Override
	public List<Food> query() {
		return foodDao.query();
	}

	@Override
	public Food findById(int id) {
		return foodDao.findById(id);
	}

	@Override
	public List<Food> query(String keyword) {
		return foodDao.query(keyword);
	}
	
	@Override
	public void getAll(PageBean<Food> pb) {
		try {
			foodDao.getAll(pb);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	@Override
	public List<Food> findByType(int type) {
		return foodDao.findByType(type);
	}
}
